-
Notifications
You must be signed in to change notification settings - Fork 585
Update the makefile to regenerate makedependfile when the developer changes the content of makedependfile.SH #23402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: blead
Are you sure you want to change the base?
Conversation
Please could you explain what making this change accomplishes? Whether the resulting file is named |
Exactly, makedepend.file: makedepend_file.SH config.sh
$(SHELL) makedepend_file.SH Here is the code of SH_to_target() {
echo $@ | sed -e s/\\\.SH//g -e s/_/./g
} An example is the target config.h: config_h.SH config.sh
$(SHELL) config_h.SH |
Yes, but why?
|
I wanted to make as few changes as possible without changing the name of Anyway, the main goal of this pull request is not about renaming. It's about recreating automatically the generated script |
Apologies if the answer is obvious, but why not add this target:
|
This is also another way to do it with even less changes. However, I prefer to use the variable |
Yeah I think that makes more sense than renaming it to |
Ok, I have added a commit for this renaming. |
I ran Before
After
Am I correct in thinking that the net effect of this p.r. is:
|
Those are side-effects. The main effect is that «make makedependfile» is now a thing, which is relevant because that is a dependency of Your question does point out that, this PR doesn't explain well why it does what it does. It needs a much better commit message IMO. |
The main effect is Once you ran Before After This main effect is due to the fact that we have added
|
7dc43cf
to
58cedfa
Compare
Ok, I've merged the two commits in one and have updated the commit message. |
58cedfa
to
3e4b685
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This now makes sense to me. I'm not really qualified to know if this is a good solution or not, but I think it solves a real problem. I think that a comment should be added in the Makefile target dependency as to why. And I think the P.R. description should be updated to include the better description of the motivation behind this p.r.
I have changed the title and the description of the pull request. Hoping it is clearer...
Not to sure to understand this... The target dependency is for generating the file. Any suggestion / example of comment that you would like to see? |
@@ -1499,7 +1499,7 @@ cscope.out cscope: $(c) $(h) | |||
# The README below ensures that the dependency list is never empty and | |||
# that when MAKEDEPEND is empty $(FIRSTMAKEFILE) doesn't need rebuilding. | |||
|
|||
MAKEDEPEND = Makefile makedepend_file makedepend | |||
MAKEDEPEND = Makefile makedependfile makedepend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add a comment like
The purpose of makedependfile is to guarantee that things get properly rebuilt when makedependfile.SH is changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added the following comment to explain how $(FIRSTMAKEFILE) is generated and its relationship with makedepend and makedependfile. Hoping that is what you wanted...
# $(FIRSTMAKEFILE) is generated by the makedepend script.
# The makedepend script uses the makedependfile script.
@@ -27,7 +27,7 @@ bug*.pl | |||
/config.sh | |||
/makeaperl | |||
/makedepend | |||
/makedepend_file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first few characters of the commit message are wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made minor edits in the p.r. description for better English grammar. I realized it was a lot easier to just do them than to point them out.
This now looks good to me, but someone who is better at Makefiles should check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first few characters of the commit message are wrong
What is wrong in the commit message? Do you mean instead something wrong in the p.r. description that you have fixed?
3e4b685
to
7eff038
Compare
…hanges the content of makedependfile.SH Before the pull request: touch makedepend_file.SH && make => Nothing happens After the pull request: touch makedependfile.SH && make => makedependfile is regenerated => *.depends are regenerated => makefile is regenerated with dependencies Adding makedependfile.SH in variable SH of Makefile.SH creates the target makedependfile in generated makefile: diff before/perl5/Makefile after/perl5/Makefile 785a786,788 > makedependfile: makedependfile.SH config.sh > $(SHELL) makedependfile.SH > It has also the consequence that makedependfile is deleted with the rest of generated files: rm -rf $(addedbyconf)
7eff038
to
c7cc452
Compare
The perl5 directory contains
*.SH
files that generate underlying files. Configure calls those*.SH
at the beginning to create the underlying files. Once Configure is done, there is a makefile that handles the compilation in an incremental way. So, during the development, if the developer changes one of those*.SH
files and runsmake
, the makefile will regenerate the underlying file and eventually will recompile what needs to be recompiled according to this change.This is true for all
*.SH
except formakedepend_file.SH
. If the developer changesmakedepend_file.SH
and runsmake
then nothing happens.The goal of this pull request is to handle the incremental compilation when a developer changes
makedepend_file.SH
.Before the pull request:
touch makedepend_file.SH && make
=> Nothing happens
After the pull request:
touch makedependfile.SH && make
=> makedependfile is regenerated
=> *.depends are regenerated
=> makefile is regenerated with dependencies
Adding
makedependfile.SH
in variableSH
ofMakefile.SH
creates the targetmakedependfile
in the generated makefile:An extra consequence is that
makedependfile
is deleted with the rest of generated files byrm -rf $(addedbyconf)
. We don't need to have a specific-rm makedepend_file
in the makefile.The renaming of
makedepend_file.SH
tomakedependfile.SH
has been done to work fine withSH_to_target()
. This function is used to build the name of the makefile target with the script name by replacing the underscore by dot. Here is the code ofSH_to_target()
where there is a sed of_
by.
:As the underlying file is a script, it was more coherent to name the target / underlying file as
makedependfile
instead ofmakedepend.file
. This to have a similar naming convention as the other generated scripts:cflags
,makedepend
,myconfig
,runtests
.PS: The description of this pull request has been rewritten after the remarks of the participants of this conversation.